package com.yl.pattern.behavioralmodel.observer;

/**
 * @Author 小羊
 * @Date 1/11/2024下午 3:17
 * @ClassName Client
 * @Description Client
 */
public class Client {
    public static void main(String[] args) {
        SubscriptionSubject mSubscriptionSubject=new SubscriptionSubject();
        //创建微信用户
        WeiXinUser user1=new WeiXinUser("孙悟空");
        WeiXinUser user2=new WeiXinUser("猪悟能");
        WeiXinUser user3=new WeiXinUser("沙悟净");
        //订阅公众号
        mSubscriptionSubject.attach(user1);
        mSubscriptionSubject.attach(user2);
        mSubscriptionSubject.attach(user3);
        //公众号更新发出消息给订阅的微信用户
        mSubscriptionSubject.notify("小羊小羊");
    }
}
